package com.main.ok.muc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.guahao.im.muc.service.share.service.MucGroupService;
import com.guahao.im.muc.service.share.service.MucOfflineService;
import com.guahao.im.service.share.base.ResponseDTO;

public class MucTest {

    public static void main(String[] args) {
        // test flush 2redis
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        // muc offline redis
         buildMucOfflineRedis(ctx);

//        buildGroupUserRedisCache(ctx);
    }

    public static void getMucMsg(ApplicationContext ctx) {
        MucOfflineService offlineService = (MucOfflineService) ctx.getBean("mucOfflineService");
//        offlineService.getMucOfflineMsg();

    }

    private static void buildGroupUserRedisCache(ApplicationContext ctx) {
        MucGroupService gService = (MucGroupService) ctx.getBean("mucGroupService");
        ResponseDTO<Boolean> s = gService.flushMucGroup2Redis();
        System.out.println(s.getDataResult());
    }

    private static void buildMucOfflineRedis(ApplicationContext ctx) {
        MucOfflineService mucService = (MucOfflineService) ctx.getBean("mucOfflineService");
        ResponseDTO<Boolean> s = mucService.flushOfflineDb2Redis();
        System.out.println(s.getDataResult());
    }


}
